#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE("Dual BSD/GPL");

void kmalloc_map_test(void){
	void *p, *q;
	p = (int *)kmalloc(PAGE_SIZE, GFP_KERNEL);
	q = (int *)kmalloc(PAGE_SIZE, GFP_KERNEL);
	if (!p || !q)
		goto out;
	printk(KERN_ERR "for p::offset:%p\n", (p - __pa(p)));
	printk(KERN_ERR "for q::offset:%p\n", (q - __pa(q)));
out:
	if (p) {
		kfree(p);
	}
	if (q) {
		kfree(q);
	}
}

static __init int test_init(void)
{
	printk(KERN_ERR "test init \n");
	kmalloc_map_test();
	return 0;
}

static __exit void test_exit(void)
{
	printk(KERN_ERR "test exit \n");
}

module_init(test_init);
module_exit(test_exit);

